package com.bbb.usercenter.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

@RestController
@RequestMapping(value = "user")
public class UserCenterController {

    @RequestMapping(method = RequestMethod.POST, value = "getLoginStatus")
    @ResponseBody
    public Map<String, Object> getLoginStatus(String token) {
        Map<String, Object> result = new HashMap<>();
        Integer code;
        String msg;
        Integer status;

        try {
            Random random = new Random();
            status = random.nextInt(1);

            code = 200;
            msg = "ok";
        } catch (Exception e) {
            code = 500;
            msg = "fail";
            status = null;
        }

        result.put("code", code);
        result.put("msg", msg);
        result.put("status", status);
        return result;
    }
}
